
NVCC = /opt/cuda/bin/nvcc

#
# Similar for OPENCC_FLAGS and PTXAS_FLAGS.
# These are simply passed via the environment:
#
export OPENCC_FLAGS :=
export PTXAS_FLAGS := -fastimul

CFLAGS = -arch=sm_11

#
# cuda and C/C++ compilation rules, with
# dependency generation:
#
%.o : %.cpp
	$(NVCC) -c $^ $(CFLAGS) -o $@
	$(NVCC) -M $^ $(CFLAGS) > $@.dep
%.o : %.c
	$(NVCC) -c $^ $(CFLAGS) -o $@
	$(NVCC) -M $^ $(CFLAGS) > $@.dep

%.o : %.cu
	$(NVCC) -c $^ $(CFLAGS) -o $@
	$(NVCC) -M $^ $(CFLAGS) > $@.dep

#
# Pick up generated dependency files, and
# add /dev/null because gmake does not consider
# an empty list to be a list:

#
include $(wildcard *.dep) /dev/null

#
# Define the application;
# for each object file, there must be a
# corresponding .c or .cpp or .cu file:
#
OBJECTS = fof.o
APP = fof
$(APP) : $(OBJECTS)
	$(NVCC) $(OBJECTS) $(LDFLAGS) -o $@

#
# Cleanup:
#
clean :
	$(RM) $(OBJECTS) $(APP) *.dep *.linkinfo
